import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// 线性布局  Column

class ColumnRoute extends StatefulWidget {
  @override
  _ColumnRouteState createState() => _ColumnRouteState();
}

class _ColumnRouteState extends State<ColumnRoute> {
  List<Widget> columnLs;

  @override
  void initState() {
    super.initState();
    columnLs = [
      Text("hi"),
      Text("world"),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("线性布局：Column嵌套Column"),
      ),
      body: Container(
        color: Colors.green,
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisSize: MainAxisSize.max, //有效、外层Column高度为整个屏幕
            children: <Widget>[
              Text("======Container 里面Row或Column所占用的空间为实际大小========"),
              Container(
                color: Colors.red,
                child: Column(
                  mainAxisSize: MainAxisSize.max, //无效，内层Column高度是实际高度
                  children: columnLs,
                ),
              ),
              Text("======Expanded 里面的Column占满外部Column========"),
              Expanded(
                child: Container(
                  color: Colors.red,
                  child: Column(
                    mainAxisSize: MainAxisSize.max, //无效，内层Column高度是实际高度
                    children: columnLs,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
